home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ue312h.zip / MSWIN.H < prev    next >
C/C++ Source or Header  |  1993-03-05  |  8KB  |  216 lines

  1. /* This file provides definitions for the C source and resource scripts
  2.    for support of operation under the Microsoft Windows environment on
  3.    an IBM-PC or compatible computer.
  4.  
  5.    Must be compiled with Borland C++ 2.0 or MSC 6.0 or later versions
  6.  
  7.    It should not be compiled if the WINDOW_MSWIN symbol is not set */
  8.  
  9. /* compile flags */
  10. #define GRINDERS    8   /* 0 to use the hourglass, 8 to use the animated
  11.                            grinder (8 is the number of animation steps) */
  12.                            
  13. #define WIN30SDK   0   /* 1 to be compatible with the Windows 3.0 SDK */
  14.  
  15. #define CARETSHAPE  0   /* 2 to have a cell-sized caret when within a
  16.                screen, 1 for a vertical bar, 0 for an
  17.                            horizontal bar */
  18.  
  19. #define MEMTRACE    1   /* adds a debugging trace to mswmem.c (used only
  20.                            if SUBALLOC (below) is 1) */
  21.  
  22. /* The SUBALLOC #define implements malloc/free/realloc by segment
  23.    suballocation routines (needed for Borland C 2.0, but not necessary
  24.    under Borland C 3.0). Not needed under MSC 7.0 either. */
  25. #if WINDOW_MSWIN32
  26.     #define SUBALLOC    0
  27. #else
  28.     #if     TURBO
  29.         #if         defined(__BORLANDC__) && (__TURBOC__<0x300)
  30.             #define SUBALLOC    1   /* BC++ 2.0 */
  31.         #else
  32.             #define SUBALLOC    0   /* TC++ 1.0 or BC++ 3.x */
  33.         #endif    /* defined(__BORLANDC__) && (__TURBOC__<0x300) */
  34.     #endif    /* TURBO */
  35.  
  36.     #if     MSC
  37.         #if         _MSC_VER < 700
  38.             #define SUBALLOC    1
  39.         #else
  40.             #define SUBALLOC    0
  41.         #endif    /* _MSC_VER < 700 */
  42.     #endif    /* MSC */
  43.  
  44. #endif    /* WINDOW_MSWIN32 */
  45.  
  46. #if !WIN30SDK
  47. #include    <shellapi.h>
  48. #endif
  49.  
  50. #include    "mswrid.h"  /* contains all the Resource IDs */
  51.  
  52. /* SDK-compatibility (Win3.0, Win3.1, WIN32) */
  53. #if WIN30SDK
  54. #define UINT    WORD
  55. #define MDITILE_VERTICAL    0x0000
  56. #define MDITILE_HORIZONTAL  0x0001
  57. #endif
  58. #if WINDOW_MSWIN32
  59. #define LPDATA(p) ((LPARAM)(LPSTR)(p))
  60. #define HDROP HANDLE
  61. #define NOTIFICATION_CODE HIWORD(wParam)    /* for WM_COMMAND parsing */
  62. #else
  63. #define LPDATA(p) ((LPSTR)(p))
  64. #define NOTIFICATION_CODE HIWORD(lParam)
  65. #define WNDPROC FARPROC
  66. #endif
  67.  
  68. /* macros */
  69. #define MLSIZE  NSTRING         /* message line buffer size */
  70.  
  71. /* offsets for the screen windows extra bytes */
  72. #define GWL_SCRPTR  0                   /* SCREEN structure pointer */
  73. #define GWW_SCRCX   (GWL_SCRPTR+sizeof(LONG))   /* client area width */
  74. #define GWW_SCRCY   (GWW_SCRCX+sizeof(WORD))       /* client area height */
  75. #define SCRWNDEXTRA (GWW_SCRCY+sizeof(WORD))
  76.  
  77. /* offsets for the frame window extra bytes */
  78. #define GWW_FRMID   0                   /* Id seen by other emacs apps */
  79. #define FRMWNDEXTRA (GWW_FRMID+sizeof(WORD))
  80.  
  81. /* structures */
  82. typedef struct  CellMetrics {   /* coordinate-related parameters of a font */
  83.     short   OffsetX, OffsetY;  /* offset of column 0 or row 0, relative
  84.                   to the client area upper left corner */
  85.     short   LeadingY, HalfLeadingY; /* external leading between rows */
  86.     short   SizeX, SizeY;       /* character cell size */
  87.     short   MLHeight;           /* height of the message line */
  88. } CellMetrics;
  89.  
  90. #ifdef  termdef     /* in mswdrv.c only */
  91. char    ProgName [] = PROGNAME;
  92. int     CurrentRow = 0;
  93. int     CurrentCol = 0;
  94. BOOL    MouseTracking = FALSE;
  95. BOOL    InternalRequest = FALSE;
  96. BOOL    TakingANap = FALSE;
  97.  
  98. /* Global uninitialized variables */
  99. HWND    hFrameWnd;          /* main (frame) window */
  100. HWND    hMDIClientWnd;      /* MDI client window */
  101. HANDLE  hEmacsInstance;     /* module instance */
  102. BOOL    Win386Enhanced;     /* Windows 386 enhanced mode */
  103. BOOL    Win31API;           /* Windows 3.1 or later version */
  104. HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  105. char    *ScreenClassName;   /* MDI childs class name */
  106. char    *MLBuf;             /* message line buffer */
  107. HFONT   hEmacsFont;         /* font used for display */
  108. CellMetrics     EmacsCM;    /* cell metrics of that font */
  109.  
  110.  
  111. #if GRINDERS != 0
  112. HCURSOR GrinderCursor [GRINDERS];/* handles for the grinder animation */
  113. int     GrinderIndex;
  114. #endif
  115.  
  116. char    *MainHelpFile;      /* Emac's help file name and useage flag */
  117. BOOL    MainHelpUsed;
  118.  
  119. char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  120. BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  121. #else
  122. extern char ProgName [DUMMYSZ];/* used all over the place for captions,
  123.                       etc... */
  124. extern int  CurrentRow;
  125. extern int  CurrentCol;     /* caret positions (in text coordinates) */
  126. extern BOOL MouseTracking;  /* TRUE if mouse in tracking/dragging mode */
  127. extern BOOL InternalRequest;
  128.     /* TRUE for a request that originates from the mswxxx modules. This
  129.        is meant to avoid infinite recursions for requests that could
  130.        come from both MS-Windows or the editor's core (for instance
  131.        resizing, screen activation...) */
  132. extern BOOL TakingANap;     /* TRUE during execution of TakeANap() */
  133.  
  134. /* Global uninitialized variables */
  135. extern HWND    hFrameWnd;          /* main (frame) window */
  136. extern HWND    hMDIClientWnd;      /* MDI client window */
  137. extern HANDLE  hEmacsInstance;     /* module instance */
  138. extern BOOL    Win386Enhanced;     /* Windows 386 enhanced mode */
  139. extern BOOL    Win31API;           /* Windows 3.1 or later version */
  140. extern HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  141. extern char    *ScreenClassName;   /* MDI childs class name */
  142. extern char    *MLBuf;             /* message line buffer */
  143. extern HFONT   hEmacsFont;         /* font used for display */
  144. extern CellMetrics     EmacsCM;    /* cell metrics of that font */
  145.  
  146. #if GRINDERS != 0
  147. extern HCURSOR GrinderCursor [GRINDERS];/* handles for the grinder animation */
  148. extern int     GrinderIndex;
  149. #endif
  150.  
  151. extern char    *MainHelpFile;      /* Emac's help file name and useage flag */
  152. extern BOOL    MainHelpUsed;
  153.  
  154. extern char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  155. extern BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  156. #endif
  157.  
  158. /* input stream access functions */
  159. void in_init (void);
  160. BOOL in_room (int n);
  161. BOOL in_check (void);
  162. void in_put (int event);
  163. int  in_get (void);
  164.  
  165. /* Windows-implementation specific functions */
  166. LONG EXPORT FAR PASCAL ScrWndProc (HWND hWnd, UINT wMsg, UINT wParam,
  167.                    LONG lParam);
  168. LONG EXPORT FAR PASCAL FrameWndProc (HWND hWnd, UINT wMsg, UINT wParam,
  169.                      LONG lParam);
  170. int FAR PASCAL GetInput (void);
  171. int FAR PASCAL TakeANap (int t);
  172.  
  173. void FAR PASCAL GenerateMenuSeq (UINT ID);
  174. KEYTAB * FAR PASCAL FindKeyBinding (void *Func);
  175. void FAR PASCAL InitMenuPopup (HMENU hMenu, LONG lParam);
  176. BOOL FAR PASCAL MenuCommand (UINT wParam, LONG lParam);
  177. HMENU FAR PASCAL GetScreenMenuHandle (void);
  178.  
  179. BOOL FAR PASCAL EatKey (UINT MsgCode, UINT wParam, LONG lParam);
  180. void FAR PASCAL MouseMessage (HWND hWnd, UINT wMsg, UINT wParam, LONG lParam);
  181. #if !WIN30SDK
  182. void FAR PASCAL DropMessage (HWND hWnd, HANDLE hDrop);
  183. #endif
  184.  
  185. void FAR PASCAL BuildCellMetrics (CellMetrics *cm, HFONT hFont);
  186. void FAR PASCAL InvalidateCells (HWND hWnd, int leftcol, int toprow,
  187.                                  int rightcol, int bottomrow);
  188. void FAR PASCAL MinimumClientSize (HWND hWnd, int NCols, int NRows,
  189.                    int *Width, int *Height);
  190. int FAR PASCAL DisplayableRows (HWND hWnd, int Height, CellMetrics *cm);
  191. int FAR PASCAL DisplayableColumns (HWND hWnd, int Width, CellMetrics *cm);
  192. void FAR PASCAL EmacsCaret (BOOL Show);
  193. void FAR PASCAL MoveEmacsCaret (HWND hWnd, int col, int row);
  194. void FAR PASCAL ShowEmacsCaret (BOOL Show);
  195. void FAR PASCAL CellToClient (HWND hWnd, POINT Cell, LPPOINT Client);
  196. void FAR PASCAL ClientToCell (HWND hWnd, POINT Client, LPPOINT Cell);
  197. void FAR PASCAL GetMinMaxInfo (HWND hWnd, LPPOINT rgpt);
  198. BOOL FAR PASCAL ScrReSize (HWND hWnd, UINT wParam, WORD cx, WORD cy);
  199. void FAR PASCAL ScrPaint (HWND hWnd);
  200. void FAR PASCAL MLPaint (void);
  201.  
  202. BOOL FAR PASCAL InMessageLine (void);
  203.  
  204. void FAR PASCAL ClipboardCleanup (void);
  205. void FAR PASCAL ScrollMessage (HWND hWnd, UINT wMsg, WORD ScrlCode, int Pos);
  206. void FAR PASCAL ScrollBars (void);
  207.  
  208. int FAR PASCAL SetWorkingDir (void);
  209.  
  210. void FAR PASCAL InitializeFarStorage (void);
  211. void FAR PASCAL JettisonFarStorage (void);
  212.  
  213. HFONT FAR PASCAL SelectFont (HDC hDC, HFONT hFont);
  214. BOOL FAR PASCAL PickEmacsFont (void);
  215. void FAR PASCAL FontInit (void);
  216.